package org.wsff.tools.api.gateway.core;

import java.io.Serializable;

/**
 * 服务过滤器
 *
 * @author ryan
 * @version Id: ProxyFilter.java, v 0.1 2022-01-19 13:26 ryan Exp $$
 */
public interface ProxyFilter<Request extends Serializable, Response extends Serializable> {

    /**
     * filter type
     */
    enum FilterType {
                     /** before invoke */
                     PRE,
                     /** after invoke */
                     POST,
                     /** finally invoke */
                     FINAL
    }

    /**
     * 代理服务过滤器
     *
     * @param context the context
     */
    void filter(GatewayContext<Request, Response> context);

    /**
     * 过滤器类型
     * <p>
     * Sub-class should provides the filter type
     *
     * @return the filter type
     */
    String filterType();
}
